home *** CD-ROM | disk | FTP | other *** search
-
- Listing 8
-
- //
- // rational.cpp
- //
- #include "mylib.h"
- #include "rational.h"
-
- rational rational::operator-()
- {
- rational result(*this);
- result.num = -result.num;
- return result;
- }
-
- rational rational::operator++(int)
- {
- rational result(*this);
- *this += 1;
- return result;
- }
-
- rational rational::operator--(int)
- {
- rational result(*this);
- *this -= 1;
- return result;
- }
-
- // ... the rest of rational.cpp as in Listing 2
-
-
-